{% extends "layouts/application.html" %}
{% block content %}

<script type="text/javascript">
	function pageselectCallback(page_id, jq){
		//alert(page_id)
		window.location.href="?page="+(page_id+1);
    }
    $(document).ready(function(){
		// Create pagination element
        $("#Pagination").pagination({{objects.paginator.count}}, {
			num_edge_entries: 2,
			num_display_entries: 8,
			current_page:({{objects.number}}-1),
            callback: pageselectCallback
        });
    });
    function to_thumb(id){
    	window.location.href="../show_files_pic/ca_"+id+"type_1";
    }
</script>
<div align="center">
  <DIV class=boxright>
    <DIV class=bltop2>
      <div align="left">
        <strong>&nbsp;&nbsp;&nbsp;当前位置：&nbsp;&nbsp;
          <a href="../index/">论坛</a>&nbsp;&nbsp;<img src="/site_media/images/zd_arrow.gif">&nbsp;&nbsp;
          <a href="#">{{obj.title}}</a>
        </strong>
      </div>
    </DIV>
    <DIV class=c_box>
      <TABLE id="forum_main" cellSpacing=1>
        <THEAD>
          <TR>
            <TH class=topic_title colSpan=2 ALIGN="center">
              <DIV class=wrapper ALIGN="center">
                <A href="/forum/show_replies/<%=@post.id%>">主题：{{obj.title}}</A>
              </DIV>
            </TH>
          </TR>
          <TR>
            <TD class=first_col>作者</TD>
            <TD class=last_col>正文</TD>
          </TR>
        </THEAD>
        <TBODY id=posts>
          <TR>
            <TD class=postauthor ALIGN="left">
              <UL>
                <LI class=name>{{obj.author}}
                <LI class=name>
                <LI>部门: {{obj.author.profile.department}}
                <LI class=name>
                <LI>文章: {{obj.author.subject_set.count}}
              </UL>
            </TD>
            <TD class=postcontent ALIGN="LEFT">
              <BR/>
              <DIV class=postactions>
                <DIV class=description>发表时间：{{obj.date|date:"Y年n月j日:h时i分"}}</DIV>
              </DIV>
              <BR/>
              <table width="100%">
                <tr>
                  <td  bgcolor="#a9d7f8" height="1"></td>
                </tr>
              </table>
              <BR/>
              {{obj.context}}
            </TD>
          </TR>
          <TR>
            <TD class=postauthor>&nbsp;</TD>
            <TD class=postcontent>&nbsp;</TD>
          </TR>

          {% for reply in objects.object_list %}
            <TR>
              <TD class=postauthor ALIGN="left">
                <UL>
                  <LI class=name>{{reply.author}}
                  <LI class=name>
                  <LI>部门: {{reply.author.profile.department}}
                  <LI class=name>
                  <LI>文章: {{reply.author.subject_set.count}}
                </UL>
              </TD>
              <TD class=postcontent ALIGN="LEFT">
                <BR/>
               {{reply.context}}
              </TD>
            </TR>
            <TR>
              <TD class=postauthor>&nbsp;</TD>
              <TD class=postcontent ALIGN="left"><span style="color:green;">回复时间：{{reply.date|date:"Y年n月j日:h时i分"}}</span>
                &nbsp;&nbsp;
                {% if user.is_superuser %}
                  <a href="/{%site_root%}/manage/forum/delete_reply/{{reply.id}}">删除</a>
                {% endif %}
              </TD>
            </TR>
          {% endfor %}
          <form action="" method="post">
            <TR>
              <TD class=postauthor ALIGN="left">
                <UL>
                  <LI class=name>
                  <LI class=name>
                  <LI>
                  <LI class=name>
                  <LI>
                </UL>
              </TD>
              <TD class=postcontent ALIGN="LEFT">
                <textarea id="context" class="text" cols="40" rows="20" name="context" style="WIDTH: 788px;HEIGHT:200PX"></textarea>
              </TD>
            </TR>
            <TR>
              <TD class=postauthor>
              </TD>
              <TD class=postcontent>
              <INPUT onclick="return chk_content();" onMouseOver="this.className='submit2'" onMouseOut="this.className='submit'" class=submit id="" type=submit value=发表回复 name="">
              </TD>
            </TR>
          </form>
        </TBODY>
      </TABLE>
      <DIV class=actions>
        <DIV class=buttons>
          <A class = new_topic title= 发表新帖 href= "../new" ></A>
        </DIV>
        <DIV class=wrapper>
          <DIV class=pagination><div id="Pagination" class="pagination"></div></DIV>
        </DIV>
      </DIV>
    </DIV>
  </DIV>
</div>
<script language="javascript">
    function chk_content()
    {
        if($("#context").val()=='')
        {
            alert("请输入内容再发表回复！");
            return false;
        }
        return true;
    }
</script>
{% endblock %}